<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <base href="<?php echo base_url(); ?>"/>
    <title>上传头像</title>
    <link href="style/base.css" rel="stylesheet" type="text/css"/>
    <link href="style/common.css" rel="stylesheet" type="text/css"/>
    <link href="style/houtai.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="ucenter/scripts/swfobject.js"></script>
    <script type="text/javascript" src="ucenter/scripts/fullAvatarEditor.js"></script>
    <script type="text/javascript">
        swfobject.addDomLoadEvent(function () {
            var swf = new fullAvatarEditor("swfContainer", {
                    id: 'swf',
                    upload_url: '<?php echo base_url();?>ucenter/php/upload.php',
                    <?php if(!empty($user['photoUrl'])){?>
                    src_url : '<?php echo base_url()."uploads/".$user['photoUrl'];?>',
                    <?php }?>
                    src_upload: 2

                }, function (msg) {
                    switch (msg.code) {

                        case 3 :
                            if (msg.type == 0) {
                                alert("摄像头已准备就绪且用户已允许使用。");
                            }
                            else if (msg.type == 1) {
                                alert("摄像头已准备就绪但用户未允许使用！");
                            }
                            else {
                                alert("摄像头被占用！");
                            }
                            break;
                        case 5 :
                            if (msg.type == 0) {
                                var imgUrl = msg.content.avatarUrls;
                                params = {phtoUrl: imgUrl};
                                $.ajax({
                                    type: "post",
                                    url: "index.php/manage/savePhoto",
                                    dataType: "json",
                                    data: params,
                                    async: false,
                                    success: function (data) {
                                        location.reload();
                                    }
                                });
                            }
                            break;
                    }
                }
            );
            /* document.getElementById("upload").onclick=function(){
             swf.call("upload");
             };*/
        });
        var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
        document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F5f036dd99455cb8adc9de73e2f052f72' type='text/javascript'%3E%3C/script%3E"));
    </script>
</head>
<body>
<?php
include 'header.php';
?>
<div class="houtai_content mt_10 clearfix">
    <!-- 侧栏 开始 -->
    <?php
    include 'member_left.php';
    ?>
    <div class="houtai_main">
        <div class="houtai_zhanghugl">
            <div class="houtai_main_tit">用户中心—账户管理</div>
            <div class="houtai_zhanghugl_cnt">
                <div style="width:630px;">
                    <div>
                        <p id="swfContainer">
                        </p>
                    </div>
                </div>

            </div>
        </div>
    </div>
    <!-- 用户中心活动经历 E -->
</div>
<!-- 页脚 开始 -->
<?php include 'footer.php'; ?>
<!-- 页脚 结束 -->
</body>
</html>